# -*- coding: utf-8 -*-
__author__ = 'Apple'

import requests
import json

data = {
    'username' : 'mushishi',
    'password' : '111111'
}

class RunMain(object):

    def __init__(self, url, method ,data = None):
        self.res = self.run_main(self, url, method ,data = None)
        
    def send_post(self, url, data):
        res = requests.post(url, data = data).json()
        return json.dumps(res, indent=2,sort_keys = True)

    def send_get(self, url, data):
        res = requests.get(url, data = data).json()
        return json.dumps(res, indent=2,sort_keys = True)

    def run_main(self, url,method, data = None):
        res = None
        if method == "GET":
            res = self.send_get(url, data)
        else:
            res = self.send_post(url, data)
        return res
if __name__ == '__main__':
    url = ''
    data = ''
    run = RunMain(url, 'GET', data)
    print(run.res)
